#!/bin/bash
# simple sanity test for cgconfigparser, cgsnapshot and cgclear tool

. `dirname $0`/../testenv.sh


mkdir -p /$TMP/cgroups/cpu 2>/dev/null
mount -t cgroup -o cpu,cpuacct cpu /$TMP/cgroups/cpu || die "Mount failed"

$TOOLSDIR/cgsnapshot -b $CONFIGDIR/cgsnapshot_blacklist.conf >/$TMP/temp.conf || die "cgsnapshot failed"
lss_o1=`$TOOLSDIR/lssubsys -m`
$TOOLSDIR/cgclear || die "1st cgclear failed"

$TOOLSDIR/cgconfigparser -l /$TMP/temp.conf || die "cgconfigparser failed"
lss_o2=`$TOOLSDIR/lssubsys -m`
$TOOLSDIR/cgclear || die "2nd cgclear failed"

if [ "$lss_o1" != "$lss_o2" ]; then
     echo "ERROR: first lss ouptput:'$lss_o1', second lss output:'$lss_o2'"
fi

cleanup
exit 0
